package cn.yinuo.website.common.security;

import cn.yinuo.website.user.entity.User;
import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TokenService {

    @Autowired
    private JavaWebToken javaWebToken;

    public boolean checkToken(String token) {
        try {
            User userDetail = javaWebToken.parseJWT(token);
            log.info("认证用户新消息:{}", userDetail);
        } catch (Exception e) {
            return false;
        }
        return true;
    }
}
